Skip to content

feat: add support for SSE MCP servers #5517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

04cfb1ed
Copy link
Contributor

@04cfb1ed 04cfb1ed commented May 5, 2025

Description

Add support for multiple MCP server types (stdio, sse, websocket) in the YAML configuration schema, ensuring backward compatibility with legacy configurations).

mcpServers:
   - name: Debug list
     type: stdio
     command: uv.exe
     args:
       - --directory
       - test-mcp-server
       - run
       - load-folders-mcp.py

   - name: Debug Local  MCP Python
     type: sse
     url: http://127.0.0.1:8000/sse

I just saw the #5511 I was working on this PR a few days ago, I leave here, but I don't know how to proceed

Closes #5359

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screenshots

[ For visual changes, include screenshots. Screen recordings are particularly helpful, and appreciated! ]

Testing instructions

[ For new or modified features, provide step-by-step testing instructions to validate the intended behavior of the change, including any relevant tests to run. ]

@04cfb1ed 04cfb1ed requested a review from a team as a code owner May 5, 2025 14:28
@04cfb1ed 04cfb1ed requested review from Patrick-Erichsen and removed request for a team May 5, 2025 14:28
Copy link

netlify bot commented May 5, 2025

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit 99b1ab2
🔍 Latest deploy log https://app.netlify.com/projects/continuedev/deploys/682a9a167a9f6e0008a0e6ef

@nejch
Copy link
Contributor

nejch commented May 5, 2025

Thanks @04cfb1ed I closed my PR to avoid confusion as it was just a quick draft I didn't spend much time on, and yours is more complete.

@enzoescipy
Copy link

Hi @04cfb1ed,

Following @nejch's suggestion on the now-closed PR #5511, I wanted to reach out here. Thank you for picking this up and creating a more complete implementation for SSE/WebSocket MCP server support! This is a feature I was really looking forward to for my own setup.

Since the original PR was a draft and I was eager to test this out, I quickly put together a working version (for my specific SSE use case) in my fork:
https://github.com/enzoescipy/continue/tree/sse-mcp-support

It mainly involved completing the URL handling in loadYaml.ts and ensuring the schema definition was correct, building upon the existing logic in MCPConnection.ts.

Please feel free to reference it if any part might be helpful for finalizing this PR (#5517). No pressure at all, just wanted to share my work in case it's useful.

Thanks again for implementing this much-needed feature, and looking forward to seeing this merged!

Copy link
Collaborator

@Patrick-Erichsen Patrick-Erichsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks solid, thanks for adding the tests as well! Just had a few small comments.

Is there an SSE server you could point me towards to test this locally?

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs May 6, 2025
@AwaisBinKaleem
Copy link

@04cfb1ed waiting for your powers for this megical feature :)

04cfb1ed added 2 commits May 18, 2025 21:07
…t) in the YAML configuration schema, ensuring backward compatibility with legacy configurations
@04cfb1ed 04cfb1ed force-pushed the feature/add-mcp-sse-in-config-yaml branch from 669fb03 to 0356b0d Compare May 19, 2025 02:11
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 19, 2025
Copy link

github-actions bot commented May 19, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@04cfb1ed
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request May 19, 2025
@04cfb1ed
Copy link
Contributor Author

The minimal python SSE server to test is this:

# requirements.txt
# Server
fastapi==0.115.4
uvicorn~=0.34
# MCP
mcp[cli]~=1.8.0
from mcp.server.fastmcp import FastMCP
from mcp.server.fastmcp.prompts import base
from starlette.applications import Starlette
from starlette.routing import Host, Mount

mcp = FastMCP("My App")


# Add an addition tool
@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers"""
    return a + b


@mcp.prompt()
def review_code(code: str) -> str:
    """Review code prompt"""
    return f"Please review this code:\n\n{code}"


@mcp.prompt()
def debug_error(error: str) -> list[base.Message]:
    """Debug error prompt"""
    return [
        base.UserMessage("I'm seeing this error:"),
        base.UserMessage(error),
        base.AssistantMessage("I'll help debug that. What have you tried so far?"),
    ]


@mcp.resource("greeting://{name}")
def get_greeting(name: str) -> str:
    """Get a personalized greeting"""
    return f"Hello, {name}!"


# Mount the SSE server to the existing ASGI server
app = Starlette(
    routes=[
        Mount("/", app=mcp.sse_app()),
    ]
)

if __name__ == "__main__":
    import uvicorn

    uvicorn.run(
        "minimal:app", host="127.0.0.1", port=8000, log_level="debug", reload=True
    )
mcpServers:
  - name: Debug Local Minimal MCP Python
    type: sse
    url: http://127.0.0.1:8000/sse

Result
imagen
imagen

@04cfb1ed 04cfb1ed requested a review from Patrick-Erichsen May 19, 2025 02:55
Copy link
Collaborator

@Patrick-Erichsen Patrick-Erichsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

cc @sestinj for a final pass. I believe any type errors with the logic in https://github.com/continuedev/continue/pull/5517/files#diff-08ccd8e386037c8ed8e2008a5de3a2a675bfaaca98adbd8609bb241d578980bcR83 should be caught in CI, and the new param is optional, so shouldn't cause any issues.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 20, 2025
@Dawntraoz
Copy link

You folks saved my day!!

Looking forward to testing this together with https://github.com/automation-ai-labs/mcp-link 🤩

@shahidazim
Copy link

Great, I can't wait for it to be merged and available to use!

@AfterStories
Copy link

AfterStories commented May 21, 2025

@Patrick-Erichsen
I would like to ask about this SSE PR. Thank you

After this PR is completed, is it supported to update the information returned by the tool in real-time in the UI?

The scenario I'm currently facing is: I have an MCP tool that always running for a long time, so I need to let the user see the running status in the UI.

If it is SSE protocol communication, I believe it should be able to stream back the current running progress information of the tool, such as running step 1... running step 2... status, displayed in real-time in the UI, so that users can know the execution status of the tool

If my SSE MCP tools use a streaming API to continuously return chuck data, I hope it can be updated in the UI

@Patrick-Erichsen Patrick-Erichsen merged commit d953ac3 into continuedev:main May 21, 2025
33 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs May 21, 2025
@github-actions github-actions bot locked and limited conversation to collaborators May 21, 2025
@Patrick-Erichsen
Copy link
Collaborator

Thanks for the great PR @04cfb1ed !

@AfterStories - that definitely sounds possible. Is it supported by MCP protocol currently? If you don't mind, please open a new issue and let's move the conversation there to keep this PR discussion focused.

@Patrick-Erichsen
Copy link
Collaborator

Patrick-Erichsen commented May 21, 2025

Hey @04cfb1ed , apologies for missing this in my original review but there appears to be an issue with configs that don't specify the transport type, so I had to rollback this PR.

The following config.yaml is failing:

mcpServers:
  - name: Memory
    command: npx
    args:
      - "-y"
      - "@modelcontextprotocol/server-memory"

with this error: Unsupported transport type: undefined

There also appears to be a typecheck error here: https://github.com/continuedev/continue/blob/main/core/config/yaml/loadYaml.ts#L454-L466

I don't think I/the team will have the bandwidth this week to look into it, but @04cfb1ed if you or anyone else can pick it up it would still be awesome to get SSE support merged 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Cannot configure MCP to use SSE mode in YAML
8 participants